package xyz.shenmegui.foodcheckserver.DO;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.Value;
import xyz.shenmegui.foodcheckserver.utils.StringUtils;

import java.io.Serializable;
import java.sql.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
/**
 * username 昵称
 * avatar 头像url
 * phone 手机号
 * password 密码
 * openid 小程序openid
 */
public class User implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private int id;
    private int age;
    private String sex;
    private String username;
    private String avatar;
    private String password;
    private String openid;
    private Date create_time;
    private Date update_time;
    private String deleted;
    private String shape;
    private String diseases;
    private String target;
    private String taboos;
    private Double height;
    private Double weight;

    public String buildCondition() {
        StringBuilder result = new StringBuilder("请为一位");
        if (StringUtils.isNotEmpty(this.getDiseases())) {
            result.append("患有").append(this.getDiseases()).append("的、");
        }
        if (StringUtils.isNotEmpty(this.getTaboos())) {
            result.append("不吃").append(this.getTaboos()).append("的、");
        }
        if (StringUtils.isNotEmpty(this.getShape())) {
            result.append("体型").append(this.getShape()).append("的、");
        }
        if (StringUtils.isNotEmpty(this.getTarget())) {
            String target = StringUtils.EMPTY;
            if ("0".equals(this.getTarget())) {
                target = "维持原有";
            } else if ("1".equals(this.getTarget())) {
                target = "减脂";
            } else if ("2".equals(this.getTarget())) {
                target = "增肌";
            }
            result.append("目标为").append(target).append("的");
        }
        result.append("人定制一份早中晚餐的食谱。要求：1.食谱应包含早餐、午餐和晚餐，并注明每餐的食材、做法和能量（单位大卡）。2.食谱应考虑到患者的饮食需求和身体状况，确保营养均衡且易于执行。3.食谱应包含足够的热量，以满足患者的日常需求，同时避免营养不良。4.食谱应简洁明了，易于理解和执行。请确保食谱符合上述格式要求，并给出详细的每餐热量分配。5.每句以中文句号结尾。");
        return result.toString();
    }
}
